// Generated from testantlr.g4 by ANTLR 4.1

package odesimulation;

import org.antlr.v4.runtime.atn.*;
import org.antlr.v4.runtime.dfa.DFA;
import org.antlr.v4.runtime.*;
import org.antlr.v4.runtime.misc.*;
import org.antlr.v4.runtime.tree.*;
import java.util.List;
import java.util.Iterator;
import java.util.ArrayList;

@SuppressWarnings({"all", "warnings", "unchecked", "unused", "cast"})
public class testantlrParser extends Parser {
	protected static final DFA[] _decisionToDFA;
	protected static final PredictionContextCache _sharedContextCache =
		new PredictionContextCache();
	public static final int
		T__2=1, T__1=2, T__0=3, ID=4, PARAM=5, ENZYME=6, NUM=7, WS=8;
	public static final String[] tokenNames = {
		"<INVALID>", "'->'", "'+'", "';'", "ID", "PARAM", "ENZYME", "NUM", "WS"
	};
	public static final int
		RULE_reactionset = 0, RULE_reaction = 1, RULE_leftside = 2, RULE_rightside = 3, 
		RULE_enzleftside = 4, RULE_enzrightside = 5, RULE_id = 6;
	public static final String[] ruleNames = {
		"reactionset", "reaction", "leftside", "rightside", "enzleftside", "enzrightside", 
		"id"
	};

	@Override
	public String getGrammarFileName() { return "testantlr.g4"; }

	@Override
	public String[] getTokenNames() { return tokenNames; }

	@Override
	public String[] getRuleNames() { return ruleNames; }

	@Override
	public ATN getATN() { return _ATN; }

	public testantlrParser(TokenStream input) {
		super(input);
		_interp = new ParserATNSimulator(this,_ATN,_decisionToDFA,_sharedContextCache);
	}
	public static class ReactionsetContext extends ParserRuleContext {
		public List<String> symbols = new ArrayList<String>();
		public ReactionContext reaction(int i) {
			return getRuleContext(ReactionContext.class,i);
		}
		public List<ReactionContext> reaction() {
			return getRuleContexts(ReactionContext.class);
		}
		public ReactionsetContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_reactionset; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).enterReactionset(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).exitReactionset(this);
		}
	}

	public final ReactionsetContext reactionset() throws RecognitionException {
		ReactionsetContext _localctx = new ReactionsetContext(_ctx, getState());
		enterRule(_localctx, 0, RULE_reactionset);
		int _la;
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(17); 
			_errHandler.sync(this);
			_la = _input.LA(1);
			do {
				{
				{
				setState(14); reaction();
				setState(15); match(3);
				}
				}
				setState(19); 
				_errHandler.sync(this);
				_la = _input.LA(1);
			} while ( _la==ID || _la==ENZYME );
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class ReactionContext extends ParserRuleContext {
		public EnzleftsideContext enzleftside() {
			return getRuleContext(EnzleftsideContext.class,0);
		}
		public RightsideContext rightside() {
			return getRuleContext(RightsideContext.class,0);
		}
		public EnzrightsideContext enzrightside() {
			return getRuleContext(EnzrightsideContext.class,0);
		}
		public LeftsideContext leftside() {
			return getRuleContext(LeftsideContext.class,0);
		}
		public ReactionContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_reaction; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).enterReaction(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).exitReaction(this);
		}
	}

	public final ReactionContext reaction() throws RecognitionException {
		ReactionContext _localctx = new ReactionContext(_ctx, getState());
		enterRule(_localctx, 2, RULE_reaction);
		try {
			setState(29);
			switch ( getInterpreter().adaptivePredict(_input,1,_ctx) ) {
			case 1:
				enterOuterAlt(_localctx, 1);
				{
				setState(21); leftside();
				setState(22); match(1);
				setState(23); rightside();
				}
				break;

			case 2:
				enterOuterAlt(_localctx, 2);
				{
				setState(25); enzleftside();
				setState(26); match(1);
				setState(27); enzrightside();
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class LeftsideContext extends ParserRuleContext {
		public List<IdContext> id() {
			return getRuleContexts(IdContext.class);
		}
		public IdContext id(int i) {
			return getRuleContext(IdContext.class,i);
		}
		public LeftsideContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_leftside; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).enterLeftside(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).exitLeftside(this);
		}
	}

	public final LeftsideContext leftside() throws RecognitionException {
		LeftsideContext _localctx = new LeftsideContext(_ctx, getState());
		enterRule(_localctx, 4, RULE_leftside);
		try {
			setState(36);
			switch ( getInterpreter().adaptivePredict(_input,2,_ctx) ) {
			case 1:
				enterOuterAlt(_localctx, 1);
				{
				setState(31); id();
				}
				break;

			case 2:
				enterOuterAlt(_localctx, 2);
				{
				setState(32); id();
				setState(33); match(2);
				setState(34); id();
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class RightsideContext extends ParserRuleContext {
		public List<IdContext> id() {
			return getRuleContexts(IdContext.class);
		}
		public IdContext id(int i) {
			return getRuleContext(IdContext.class,i);
		}
		public RightsideContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_rightside; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).enterRightside(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).exitRightside(this);
		}
	}

	public final RightsideContext rightside() throws RecognitionException {
		RightsideContext _localctx = new RightsideContext(_ctx, getState());
		enterRule(_localctx, 6, RULE_rightside);
		try {
			setState(44);
			switch ( getInterpreter().adaptivePredict(_input,3,_ctx) ) {
			case 1:
				enterOuterAlt(_localctx, 1);
				{
				}
				break;

			case 2:
				enterOuterAlt(_localctx, 2);
				{
				setState(39); id();
				}
				break;

			case 3:
				enterOuterAlt(_localctx, 3);
				{
				setState(40); id();
				setState(41); match(2);
				setState(42); id();
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class EnzleftsideContext extends ParserRuleContext {
		public IdContext id() {
			return getRuleContext(IdContext.class,0);
		}
		public TerminalNode ENZYME() { return getToken(testantlrParser.ENZYME, 0); }
		public EnzleftsideContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_enzleftside; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).enterEnzleftside(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).exitEnzleftside(this);
		}
	}

	public final EnzleftsideContext enzleftside() throws RecognitionException {
		EnzleftsideContext _localctx = new EnzleftsideContext(_ctx, getState());
		enterRule(_localctx, 8, RULE_enzleftside);
		try {
			setState(53);
			switch (_input.LA(1)) {
			case ID:
				enterOuterAlt(_localctx, 1);
				{
				setState(46); id();
				setState(47); match(2);
				setState(48); match(ENZYME);
				}
				break;
			case ENZYME:
				enterOuterAlt(_localctx, 2);
				{
				setState(50); match(ENZYME);
				setState(51); match(2);
				setState(52); id();
				}
				break;
			default:
				throw new NoViableAltException(this);
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class EnzrightsideContext extends ParserRuleContext {
		public List<IdContext> id() {
			return getRuleContexts(IdContext.class);
		}
		public TerminalNode ENZYME() { return getToken(testantlrParser.ENZYME, 0); }
		public IdContext id(int i) {
			return getRuleContext(IdContext.class,i);
		}
		public EnzrightsideContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_enzrightside; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).enterEnzrightside(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).exitEnzrightside(this);
		}
	}

	public final EnzrightsideContext enzrightside() throws RecognitionException {
		EnzrightsideContext _localctx = new EnzrightsideContext(_ctx, getState());
		enterRule(_localctx, 10, RULE_enzrightside);
		try {
			setState(65);
			switch ( getInterpreter().adaptivePredict(_input,5,_ctx) ) {
			case 1:
				enterOuterAlt(_localctx, 1);
				{
				setState(55); match(ENZYME);
				}
				break;

			case 2:
				enterOuterAlt(_localctx, 2);
				{
				setState(56); match(ENZYME);
				setState(57); match(2);
				setState(58); id();
				}
				break;

			case 3:
				enterOuterAlt(_localctx, 3);
				{
				setState(59); match(ENZYME);
				setState(60); match(2);
				setState(61); id();
				setState(62); match(2);
				setState(63); id();
				}
				break;
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static class IdContext extends ParserRuleContext {
		public Token ID;
		public TerminalNode ID() { return getToken(testantlrParser.ID, 0); }
		public IdContext(ParserRuleContext parent, int invokingState) {
			super(parent, invokingState);
		}
		@Override public int getRuleIndex() { return RULE_id; }
		@Override
		public void enterRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).enterId(this);
		}
		@Override
		public void exitRule(ParseTreeListener listener) {
			if ( listener instanceof testantlrListener ) ((testantlrListener)listener).exitId(this);
		}
	}

	public final IdContext id() throws RecognitionException {
		IdContext _localctx = new IdContext(_ctx, getState());
		enterRule(_localctx, 12, RULE_id);
		try {
			enterOuterAlt(_localctx, 1);
			{
			setState(67); ((IdContext)_localctx).ID = match(ID);
			if ( !((ReactionsetContext)getInvokingContext(0)).symbols.contains((((IdContext)_localctx).ID!=null?((IdContext)_localctx).ID.getText():null)) ) { ((ReactionsetContext)getInvokingContext(0)).symbols.add((((IdContext)_localctx).ID!=null?((IdContext)_localctx).ID.getText():null)); } 
			}
		}
		catch (RecognitionException re) {
			_localctx.exception = re;
			_errHandler.reportError(this, re);
			_errHandler.recover(this, re);
		}
		finally {
			exitRule();
		}
		return _localctx;
	}

	public static final String _serializedATN =
		"\3\uacf5\uee8c\u4f5d\u8b0d\u4a45\u78bd\u1b2f\u3378\3\nI\4\2\t\2\4\3\t"+
		"\3\4\4\t\4\4\5\t\5\4\6\t\6\4\7\t\7\4\b\t\b\3\2\3\2\3\2\6\2\24\n\2\r\2"+
		"\16\2\25\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\3\5\3 \n\3\3\4\3\4\3\4\3\4\3\4"+
		"\5\4\'\n\4\3\5\3\5\3\5\3\5\3\5\3\5\5\5/\n\5\3\6\3\6\3\6\3\6\3\6\3\6\3"+
		"\6\5\68\n\6\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\3\7\5\7D\n\7\3\b\3\b\3"+
		"\b\3\b\2\t\2\4\6\b\n\f\16\2\2I\2\23\3\2\2\2\4\37\3\2\2\2\6&\3\2\2\2\b"+
		".\3\2\2\2\n\67\3\2\2\2\fC\3\2\2\2\16E\3\2\2\2\20\21\5\4\3\2\21\22\7\5"+
		"\2\2\22\24\3\2\2\2\23\20\3\2\2\2\24\25\3\2\2\2\25\23\3\2\2\2\25\26\3\2"+
		"\2\2\26\3\3\2\2\2\27\30\5\6\4\2\30\31\7\3\2\2\31\32\5\b\5\2\32 \3\2\2"+
		"\2\33\34\5\n\6\2\34\35\7\3\2\2\35\36\5\f\7\2\36 \3\2\2\2\37\27\3\2\2\2"+
		"\37\33\3\2\2\2 \5\3\2\2\2!\'\5\16\b\2\"#\5\16\b\2#$\7\4\2\2$%\5\16\b\2"+
		"%\'\3\2\2\2&!\3\2\2\2&\"\3\2\2\2\'\7\3\2\2\2(/\3\2\2\2)/\5\16\b\2*+\5"+
		"\16\b\2+,\7\4\2\2,-\5\16\b\2-/\3\2\2\2.(\3\2\2\2.)\3\2\2\2.*\3\2\2\2/"+
		"\t\3\2\2\2\60\61\5\16\b\2\61\62\7\4\2\2\62\63\7\b\2\2\638\3\2\2\2\64\65"+
		"\7\b\2\2\65\66\7\4\2\2\668\5\16\b\2\67\60\3\2\2\2\67\64\3\2\2\28\13\3"+
		"\2\2\29D\7\b\2\2:;\7\b\2\2;<\7\4\2\2<D\5\16\b\2=>\7\b\2\2>?\7\4\2\2?@"+
		"\5\16\b\2@A\7\4\2\2AB\5\16\b\2BD\3\2\2\2C9\3\2\2\2C:\3\2\2\2C=\3\2\2\2"+
		"D\r\3\2\2\2EF\7\6\2\2FG\b\b\1\2G\17\3\2\2\2\b\25\37&.\67C";
	public static final ATN _ATN =
		ATNSimulator.deserialize(_serializedATN.toCharArray());
	static {
		_decisionToDFA = new DFA[_ATN.getNumberOfDecisions()];
		for (int i = 0; i < _ATN.getNumberOfDecisions(); i++) {
			_decisionToDFA[i] = new DFA(_ATN.getDecisionState(i), i);
		}
	}
}